package com.mazaiting.manager.api;

import com.mazaiting.common.core.domain.result.Result;
import com.mazaiting.manager.api.fallback.UserFeignFallbackClient;
import com.mazaiting.manager.constant.ApiConstant;
import com.mazaiting.manager.dto.UserAuthDTO;
import org.springframework.cloud.openfeign.FeignClient;
import org.springframework.web.bind.annotation.GetMapping;
import org.springframework.web.bind.annotation.PathVariable;

/**
 * 用户信息远程调用客户端
 */
@FeignClient(value = ApiConstant.SERVICE_MANAGER, path = ApiConstant.PATH_MANAGER_USER,
        contextId = ApiConstant.CONTEXT_ID_USER, fallback = UserFeignFallbackClient.class)
public interface IUserFeignClient {

    /**
     * 根据用户名获取认证信息
     * @param username 用户名
     * @return 认证信息
     */
    @GetMapping("username/{username}")
    Result<UserAuthDTO> getUserByUsername(@PathVariable String username);

    /**
     * 根据手机号获取认证信息
     *
     * @param mobile 手机号
     * @return 用户认证信息
     */
    @GetMapping("mobile/{mobile}")
    Result<UserAuthDTO> getUserByMobile(@PathVariable String mobile);
}